<template>
  <div>
    <h2>防抖和节流</h2>
    <div>
      <button @click="debouncedClick">防抖</button>
    </div>
    <div>
      <button @click="throttleClick">节流</button>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
import { Throttle, Debounced } from '@/utils'
const throttle = new Throttle()
const debounced = new Debounced()

@Component({
  name: 'UtilsTest',
  methods: {
    debouncedClick: (debounced.use(function() {
      console.log('点击防抖')
    }, 2000, true) as any),
    throttleClick: (throttle.use(function() {
      console.log('点击节流')
    }, 2000) as any),
  },
})
export default class extends Vue {

}

</script>

<style>

</style>
